<?php  include  $this->admin_tpl('header'); ?>
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/haidaoblue/easyui.css">
<link rel="stylesheet" type="text/css" href="<?php echo JS_PATH;?>EasyUI/themes/icon.css">
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>EasyUI/hd_default_config.js"></script>

<script type="text/javascript" src="<?php echo JS_PATH;?>layer/layer.js"></script>
<style type="text/css">
	.layui-layer-content{ text-align: center; }
	.layui-layer-content img{ max-height: 500px; }
</style>
<div class="content">
	<div class="site">
	<?php echo C('site_name')?> <a href="#">财务管理</a> > 分红列表+邀请列表
	</div>
    <div id="cc" class="easyui-calendar"></div>
	<span class="line_white"></span>
	<div class="goods mt10">
		<div class="search_ind">
			<!-- <input type="hidden" name="m" value="<?php echo GROUP_NAME ?>">
			<input type="hidden" name="c" value="<?php echo MODULE_NAME ?>">
			<input type="hidden" name="a" value="<?php echo ACTION_NAME ?>"> -->
            <span style="margin-right: 10px;">状态 </span>
            <!-- <select name='status' id='group_combbox' class="easyui-combobox" data-options="editable:false,panelHeight:'auto'" style="height: 26px; width:100px;">
                </select> -->
            <select name='status' id='group_combbox' class="easyui-combobox" data-options="editable:false,panelHeight:'auto'" style="height: 26px; width:100px;">
            </select>
             <span style="margin-right: 10px;">开始时间 </span>
                <input class="easyui-datebox" name="start" id="start" data-options="sharedCalendar:'#cc'">
                <span style="margin-right: 10px;">至</span>
                <input class="easyui-datebox" name="end" id="end" data-options="sharedCalendar:'#cc'" validType="md['#start']">
			<span style="margin-right: 10px;">搜索查询 </span>
			<input id="keyword" class="easyui-textbox" name="keyword" style="width:210px;height: 26px;" prompt="输入会员名称|真实姓名查询">
			<a id="search" href="javascript:;" class="easyui-linkbutton" style="height: 26px;padding-right: 10px;">查询</a>
		</div>
		
		<div class="login mt10" style="border: none;border-right: 1px solid #e6e6e6;">
			<!-- 日志信息 -->
			<dl id="admin_moneylog" style="width:100%;">
			</dl>
			<!-- 财务设置 -->
		</div>
		<div class="clear"></div>
		<?php include $this->admin_tpl('copyright') ?>
	</div>


    <!-- 审核弹框 -->
    <div id="moneypanel" class="easyui-window"  style="width:320px;" closed="true" modal="true" minimizable="false" maximizable="false" collapsible="false" data-options="title:'审核'">
		<form id="SetMoneyForm1" class="setmoneyform" method="post" action="<?php echo U('checks_oil'); ?>">
		<div class="login " style="border: none;">
			<div class="table">
				<table>
				<tr style="border-top: none;">
					<td>处理方式</td>
					<td align="left">
                            <input type="radio" value="2" name="status" checked>通过 
                            <input type="radio" value="3" name="status">驳回
                    </td>
					<td align="left"></td>
				</tr>
				<tr style="border-bottom:1px solid #CCCCCC;border-top: none;">
					<td>驳回原因:</td>
					<td align="left" colspan="2">
						<input type="text" value="" style="margin:0;" class="input_ss" name="remarks" placeholder="审核通过可以不填写">
					</td>
				</tr>
				</table>
			</div>
		</div>
		<div data-options="region:'south',border:false" style="text-align:right;padding:5px 20px;">
			<a class="easyui-linkbutton"  href="javascript:void(0)" onclick="$('#SetMoneyForm1').submit()" style="padding: 0 10px;">确定</a>
			<a class="easyui-linkbutton"  href="javascript:void(0)" onclick="$('#moneypanel').window('close');" style="padding: 0 10px;">取消</a>
		</div>
			<input type="hidden" name="id" value="" />
		</form>
	</div>

</div>
<script type="text/javascript">
var dom = $('#admin_moneylog');
var pageSize = <?php echo PAGE_SIZE?>;
var dataurl = '<?php echo U('oil')?>';


// var delurl = '<?php echo U('delete')?>';
var keyword = '<?php echo $keyword?>';
var user_id = '<?php echo $user_id?>';
$(function(){
	dom.datagrid({
		url:dataurl,

		striped:true,
		width:'100%',
		checkOnSelect:false,
		title:"统计概览",  
		fitColumns:true,
		// toolbar:[
		// 	// {
		// 	// 	id:'delrows',
		// 	// 	text:'删除',
		// 	// 	iconCls:'icon-del',
		// 	// },'-',
		// 	// {
		// 	// 	id:'exportrows',
		// 	// 	text:'导出',
		// 	// 	iconCls:'icon-export',
		// 	// }
		// ],
		frozenColumns:[[
			{field:'id',checkbox:true}
		]],
		queryParams:{
			keyword:keyword
		},
		scrollbarSize:0,
		pagination:true,
		pageSize:pageSize,
		pageList: [pageSize,pageSize*4,pageSize*8,pageSize*16,pageSize*32,pageSize*64],
		//可以设置每页记录条数的列表
		columns:[[
			{field:'username',title:'会员账号',width:'7%',halign:'center',align:'center'},
			{field:'real_name',title:'会员真实姓名',width:'7%',halign:'center',align:'center'},
            {field:'username',title:'手机号',width:'7%',halign:'center',align:'center'},
			{field:'price',title:'价格GF',width:'7%',halign:'center',align:'center'},
			{field:'goods_remarks',title:'详情',width:'20%',halign:'center',align:'center'},
			// {field:'balance',title:'充值金额',width:'7%',halign:'center',align:'center'},
			// {field:'upvaluation',title:'消耗升值链',width:'5%',halign:'center',align:'center',sortable:true},
			// {field:'oil_number',title:'加油卡号',width:'7%',halign:'center',align:'center'},
			// {field:'name',title:'加油者姓名',width:'7%',halign:'center',align:'center'},
			// {field:'paper_type',title:'证件类型',width:'7%',halign:'center',align:'center'},
			// {field:'paper_number',title:'证件号码',width:'7%',halign:'center',align:'center'},
			// {field:'type',title:'类型',width:'5%',halign:'center',align:'center',
			// 	formatter:function(value,row,index){
			// 		if(value==1) return "中国石油"; 
			// 		if(value==2) return "中国石化";
			// 	}
			// },
            {field:'status',title:'状态',width:'5%',halign:'center',align:'center',
				formatter:function(value,row,index){
					if(value==1) return "<span class=red>发起申请</span>"; 
					if(value==2) return "<span class=green>成功</span>";
                    if(value==3) return "<span class=gray>驳回</span>"; 
				}
			},
			{field:'update_time',title:'时间',width:'10%',align:'center',sortable:true},
            {field:'userID',title:'操作',width:'5%',align:'center',halign:'center',
				formatter:function(value,row,index){
					if(row.status == 1){
						return '<a  href="javascript:void (0)" onclick=check_pass("'+row.id+'")>审核</a>';
					}else if(row.status == 2){
						return '暂无操作';
					}else{
                        return '<a href="javascript:void (0)" onclick=view_reason("'+row.remarks+'")>查看原因</a>';
                    }
				}
			},
		]],
		onLoadSuccess:function(data){
			// $(".panel-title").html(data.title);
           
			var group = data.status;
            
			group.unshift({"id":"","name":"请选择"});
			$('#group_combbox').combobox({
				data:group,
				valueField:'id',
				textField:'name'
			});
		}
	});
	// $('#exportrows').bind('click', function(){
	// 		var start=$('#start').datebox('getValue');
	// 		var end=$('#end').datebox('getValue');
	// 		var keyword=$('#keyword').val();
	// 		var type=$('#group_combbox').combobox('getValue');
	// 		window.location.href="/index.php?m=user&c=admin_silver_log&a=index&act=excel&start="+start+"&end="+end+"&keyword="+keyword+"&type="+type;
	// 	});
	//回车查询
	$('#keyword').textbox('textbox').bind('keydown',function (e) {
		if (e.keyCode == 13) {
			$('#search').trigger('click');
		}
	});
});
//增加查询参数，重新加载表格
$('#search').bind('click',function (){
	var queryParams = dom.datagrid('options').queryParams;
	//查询参数直接添加在queryParams中
	queryParams.start = $('#start').datebox('getValue');
	queryParams.end = $('#end').datebox('getValue');
	queryParams.keyword = $("#keyword").val();
	queryParams.status = $('#group_combbox').combobox('getValue');
	dom.datagrid('options').queryParams = queryParams;
	dom.datagrid('reload');
})
function showImg(img){

    layer.open({
        type: 1,
        title: "交易凭证",
        closeBtn: 1,
        area: ['1000px','600px'],
        shadeClose: 0,
        content: '<img  src="'+img+'" />'
    });
}

function view_reason(value){
    alert(value);
}

function check_pass(index){
    $('input[name="id"]').val(index);
	$('#moneypanel').window('open');
}

</script>
